<div>
    <script></script>
    <fieldset>
        <legend>Выбор издания</legend>

        <div style="padding-left: 0.3em;" class="MarginBottom">
            <p>Выбирите издание, которое нужно добавить в библиотечный фонд</p>
            <?php echo $this->EditTypes()->ToHtml(); ?>
            <input type="text" id="SearchVal" class="Wide Text"/>
            <input type="button" value="Найти" id="FindEdit"/>
        </div>

    </fieldset>

    <div id="SearchResult"></div>

    <script type="text/javascript">
        jsun.run(function() {
        //////////////////////////////////////////////////////

        jsun("#FindEdit").jsun.event({ onclick: Search });

        function Search() {
            var client = jsun("#SearchResult");
            jsun.load_html(client, "u=Lib&p=Lib\\Inventory/SearchResult"
                + "&EditType=" + jsun("#EditType").value
                + "&SearchVal=" + jsun("#SearchVal").value, null, function() {
                    var links = jsun("#SearchResult").getElementsByTagName("a");
                    for (var i = 0; i < links.length; ++i) {
                        jsun.dom.mix(links[i]).event({ onclick: AddDialog });
                    }
                });
        }

        function AddDialog() {
            return new jsun.dialog({ width: 400 }).show(
                "u=Lib&p=Lib\\Inventory/AddItem&edit_id="
                    + this.parentNode.parentNode.getAttribute("data-edit"));
        }

        ///////////////////////////////////////////////////////
        });
    </script>
</div>